<?php
class Controller_Public_Monitor extends Controller_Template
{
    public function __construct($req, $res)
    {
        $this->template = "smarty:public/default";
        parent::__construct($req, $res);
    }

    public function action_payment()
    {
        $config = Kohana::config('monitor.payment_sync');
        $query['username']  = 'monitor';
        $query['cpid']   = '100299';
        $list = IAppPay::search('payment', $query, 0, 20);
        $last_row = $list['list'][0];
        $status = time() - strtotime($last_row['ordertime']) <= $config['time'] ? true : false;
        $this->template->set_filename('smarty:public/monitor/payment');
        $this->template->set('list', $list);
        $this->template->set('config', $config);
        $this->template->set('status', $status);
    }
}
